<?php

namespace App\Models\Orm;
use Illuminate\Database\Eloquent\Model;

class CooperativeCompany extends Model
{

    const TABLE_NAME = 'cooperative_company';
    const PRIMARY_KEY = 'id';

    const ACCOUNT_TYPE_MYD = 1;     // 民营贷类
    const ACCOUNT_TYPE_YHD = 2;     // 银行贷类
    const ACCOUNT_TYPE_QD = 3;      // 渠道类
    const ACCOUNT_TYPE_SH = 4;      // 商户类

    public static $account_type_text = [
        self::ACCOUNT_TYPE_MYD => '普惠贷类',
        self::ACCOUNT_TYPE_YHD => '银行贷类',
        self::ACCOUNT_TYPE_QD => '渠道类',
        self::ACCOUNT_TYPE_SH => '商户类',
    ];

    const IS_AUTH_OFF = 0;          // 未认证
    const IS_AUTH_ON = 1;           // 已认证

    public static $is_auth_text = [
        self::IS_AUTH_OFF => '未认证',
        self::IS_AUTH_ON => '已认证',
    ];

    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = self::TABLE_NAME;
    //主键id
    protected $primaryKey = self::PRIMARY_KEY;
    //查询字段
    protected $visible = [];
    //加黑名单
    protected $guarded = [];

    public static function getAccountTypeText($account_type)
    {
        return self::$account_type_text[$account_type] ?: ' ';
    }

    public static function getIsAuthText($is_auth)
    {
        return self::$is_auth_text[$is_auth] ?: ' ';
    }
}
